<?php
/**
 * 广告位
 * User: cxm
 * Date: 2020/8/16
 * Time: 14:54
 */
namespace Seeds\Admin;

use App\Models\AdminPermission;
class AdvSeeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public static function run()
    {
        // 一级
        $adv = AdminPermission::create([
            'pid' => 0, 'sort' => 220, 'http_method' => ['GET'], 'name' => '广告管理', 'fid' => null, 'icon' => 'el-icon-position',
            'http_path' => 'javascript', 'menu_switch' => 2
        ]);

        /** ++++++++++++++++++++++++++++ 广告位 start ++++++++++++++++++++++++++++++++++*/
        $position = AdminPermission::create([
            'pid' => $adv->id, 'sort' => 10, 'http_method' => ['GET'], 'name' => '广告位管理', 'fid' => null, 'icon' => 'ios-book',
            'url'=>'adv_position','http_path' => 'javascript', 'menu_switch' => 2
        ]);
        // 列表
        AdminPermission::create([
            'pid' => $position->id, 'sort' => 10, 'http_method' => ['POST'], 'name' => '列表', 'fid' => $position->id, 'icon' => 'ios-book',
            'url'=>'','http_path' => '/admin/adv/position/get-lists', 'menu_switch' => 1
        ]);

        // 处理
        AdminPermission::create([
            'pid' => $position->id, 'sort' => 10, 'http_method' => ['POST'], 'name' => '列表', 'fid' => null, 'icon' => 'ios-book',
            'url'=>'','http_path' => '/admin/adv/position/store', 'menu_switch' => 1
        ]);

        // 删除
        AdminPermission::create([
            'pid' => $position->id, 'sort' => 10, 'http_method' => ['POST'], 'name' => '列表', 'fid' => null, 'icon' => 'ios-book',
            'url'=>'','http_path' => '/admin/adv/position/delete', 'menu_switch' => 1
        ]);
        // 所有的广告位
        AdminPermission::create([
            'pid' => $position->id, 'sort' => 10, 'http_method' => ['POST'], 'name' => '所有广告位', 'fid' => null, 'icon' => 'ios-book',
            'url'=>'','http_path' => '/admin/adv/position/getIdAndName', 'menu_switch' => 1
        ]);
        /** ++++++++++++++++++++++++++++ 广告位 end ++++++++++++++++++++++++++++++++++*/

        /** ++++++++++++++++++++++++++++ 广告 start ++++++++++++++++++++++++++++++++++*/
        $adv_list = AdminPermission::create([
            'pid' => $adv->id, 'sort' => 20, 'http_method' => ['GET'], 'name' => '广告管理', 'fid' => null, 'icon' => 'ios-book',
            'url'=>'adv_list','http_path' => 'javascript', 'menu_switch' => 2
        ]);
        // 列表
        AdminPermission::create([
            'pid' => $adv_list->id, 'sort' => 10, 'http_method' => ['POST'], 'name' => '列表', 'fid' => $adv_list->id, 'icon' => '',
            'url'=>'','http_path' => '/admin/adv/get-lists', 'menu_switch' => 1
        ]);

        // 处理
        AdminPermission::create([
            'pid' => $adv_list->id, 'sort' => 10, 'http_method' => ['POST'], 'name' => '列表', 'fid' => null, 'icon' => '',
            'url'=>'','http_path' => '/admin/adv/store', 'menu_switch' => 1
        ]);

        // 删除
        AdminPermission::create([
            'pid' => $adv_list->id, 'sort' => 10, 'http_method' => ['POST'], 'name' => '列表', 'fid' => null, 'icon' => '',
            'url'=>'','http_path' => '/admin/adv/delete', 'menu_switch' => 1
        ]);
        // 排序
        AdminPermission::create([
            'pid' => $position->id, 'sort' => 10, 'http_method' => ['POST'], 'name' => '排序', 'fid' => null, 'icon' => '',
            'url'=>'','http_path' => '/admin/adv/updateSort', 'menu_switch' => 1
        ]);
        /** ++++++++++++++++++++++++++++ 广告位 end ++++++++++++++++++++++++++++++++++*/
    }
}